package org.chengn.level_easy.context83;

import org.chengn.definition.ListNode;

/**
 * @Title: Context83
 * @Author ChengN
 * @Package org.chengn.level_easy.context83
 * @Date 2024/1/14 12:32
 * @description: 删除排序链表中的重复元素
 */
public class Context83 {
    public ListNode deleteDuplicates(ListNode head) {
        if(head == null || head.next == null) return head;
        ListNode nextNode = deleteDuplicates(head.next);
        if (head.val == nextNode.val) {
            return nextNode;
        }
        head.next = nextNode;
        return head;

    }
}
